import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { SArenaCrossPlayerResult } from "../../../../../Message/Public/SArenaCrossPlayerResult";
import { CareerConfig } from "../../../resource/CareerConfig";
import { ObjTeamCreate } from "../../common/ObjTeamCreate";
import { Language } from "../../../../../extend/language/Language";
//class ArenaCrossPlayerResult
    
    export  class ArenaCrossPlayerResult /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 14, 15788607);
            var loc2=new GTextFormat(FontUtil.songtiName, 20, 15788607);
            this._tfName = ObjCreate.createTextField("", 70, 12, 120, 22, this, loc1);
            this._tfCareer = ObjCreate.createTextField("", 130, 35, 50, 20, this, GlobalStyle.textFormat2);
            this._tfLevel = ObjCreate.createTextField("", 70, 35, 50, 20, this, GlobalStyle.textFormat2);
            this._tfPower = ObjCreate.createTextField("", 30, 55, 120, 20, this);
            this._tfTotalHurt = ObjCreate.createTextField("", 30, 72, 120, 20, this);
            this._tfTotalCure = ObjCreate.createTextField("", 30, 90, 120, 20, this);
            this._tfWinPer = ObjCreate.createTextField("", 18, 124, 150, 30, this, loc2);
            return;
        }

        public updateResult(arg1: SArenaCrossPlayerResult, arg2: Boolean=false): void
        {
            this._tfName.text = arg1.miniPlayer.name;
            var loc1="0";
            if (arg1.winNum + arg1.loseNum > 0) 
            {
                loc1 = (arg1.winNum * 100 / (arg1.winNum + arg1.loseNum)).toFixed(2);
            }
            this._tfCareer.text = CareerConfig.instance.getInfoByCode(arg1.miniPlayer.careerEnable).name;
            this._tfLevel.text = "LV." + arg1.miniPlayer.level.toString();
            ObjTeamCreate.setTextFieldKeyValue(this._tfPower, Language.getString(42238), arg1.miniPlayer.warfare.toString());
            ObjTeamCreate.setTextFieldKeyValue(this._tfTotalHurt, Language.getString(42239), arg1.totalHurt.toString());
            ObjTeamCreate.setTextFieldKeyValue(this._tfTotalCure, Language.getString(42240), arg1.totalCure.toString());
            this._tfWinPer.htmlText = Language.getStringByParam(44203, loc1);
            return;
        }

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfLevel: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCareer: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfPower: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTotalHurt: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTotalCure: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfWinPer: Object /* flash.text.TextField */;
    }
